<template>
  <div class="dashboard-container">
  <div class="item">
        <h1>学校数量</h1>
        <h1>{{schoolCount}}</h1>
      </div>
      <div class="item">
        <h1>全校学院数量</h1>
        <h1>{{academyCount}}</h1>
      </div>
    
    <div class="item">
        <h1>全校班级数量</h1>
        <h1>{{classsCount}}</h1>
     </div>
    
    <div class="item">
        <h1>全校学生人数</h1>
        <h1>{{studentCount}}</h1>
      </div>
    
    <div class="item">
        <h1>全校老师人数</h1>
        <h1>{{teacherCount}}</h1>
      </div>
   </div>
</template>

<script>
  import { mapGetters } from 'vuex'

  export default {
    name: 'Dashboard',
    computed: {
      ...mapGetters([
        'name'
      ])
    },
    data(){
      return {
      academyCount: '',
      classsCount: '',
      studentCount: '',
      teacherCount: '',
      }
    },

    mounted(){
      this.$http.get('/api/school/count').then(res => {
        this.schoolCount = res
      })
      this.$http.get('/api/student/count').then(res => {
        this.studentCount = res
      })
    
    this.$http.get('/api/teacher/count').then(res => {
        this.teacherCount = res
      })
    
    this.$http.get('/api/academy/count').then(res => {
        this.academyCount = res
      })
    
    this.$http.get('/api/classs/count').then(res => {
        this.classsCount = res
      })
    }
  }
</script>

<style lang="scss" scoped>
  .dashboard {
    &-container {
      margin: 30px;
    }
    &-text {
      font-size: 30px;
      line-height: 46px;
    }
  }
  .item{
  float: left;
  width: 150px;
    text-align: center;
    transition: all 0.6s;
    position: relative;
    top: 0;
    border-radius: 3px;
    box-shadow: 0 0 0 0 rgbe(0,0,0,0.1);
    padding: 10px;
  }
</style>
